#include"processbar.h"

typedef void(*callback_t)(int);

void download(callback_t cb)
{

    //模拟下载的场景
    int total = 1000;
    int curr = 0;

    while(curr <= total)
    {
       cb(curr*100/total);
        curr+=10;
        usleep(50000);
    }
    printf("\n");
}

int main()
{  
    download(processbar);
    return 0;
}
